<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" title="对账批次详情" width="700px">
    <MyAlert 
      type="warning"
      message="当因为跨日支付而导致的账单差异(单边账), 系统会在次日自动处理, 无需人工处理忽略"
    />
    <Description :column="2" :bordered="false" :data="detailData" @register="registerDescription" />
  </BasicDrawer>
</template>
<script lang="ts" setup>
import { ref, useAttrs } from 'vue';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { formDetailSchema } from './data';
import { Description, useDescription } from '/@/components/Description/index';
import { getCheckBatch } from './api';
import MyAlert from '/@/components/My/MyAlert.vue';
const emit = defineEmits(['register']);
const attrs = useAttrs();
const detailData = ref({});
const [registerDescription] = useDescription({
  schema: formDetailSchema,
  labelStyle: {
    marginLeft: '10px',
    // width: '100px'
  }
});

const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
  setDrawerProps({confirmLoading: false, loading: true})
  try {
    detailData.value = await getCheckBatch({id: data.record.batchNo})
  } finally {
    setDrawerProps({ loading: false })
  }
});
</script>
